package day5.jiekou.fight;

public class ClassDateInterimp2 extends student implements  ClassDataInter{
    student students[]=new student[5];
    public  ClassDateInterimp2(){}
    public ClassDateInterimp2(student students[])
    {
        this.students=students;
    }


    @Override
    public void printDate()
    {      int malesum=0;
        for(int i=0;i<students.length;i++)
        {
                if(students[i].getSex()=='男')malesum++;
            System.out.print(students[i].getName()+" ");
            System.out.print(students[i].getSex()+" ");
            System.out.println(students[i].getScore());
        }
        System.out.println("男生的人数："+malesum+"女生的人数："+(students.length-malesum));
    }
    @Override
    public void printAverage()
    {
        double MAX=-1,MIN=9999999,sum=0;
        for(int i=0;i<students.length;i++)
        {
            sum+=students[i].getScore();
            if(students[i].getScore()>MAX)MAX=students[i].getScore();
            if(students[i].getScore()<MIN)MIN=students[i].getScore();
        }
        System.out.println("最高分：" + MAX+"最低分："+MIN);
        System.out.println("平均成绩是："+((sum-MAX-MIN)/(students.length-2)));
    }

}
